<template>
	<view>
		<view class="main">
			<view v-if="lists.length > 0" class="list">
				<view class="item" v-for="(item, index) in lists" :key="index" @click="dayClick(item.date)">
					<view class="left">
						<view class="title">
							<text>{{item.date_cn}}</text>
						</view>
						<view class="money">
							<text>收益：</text>
							<text>{{item.total}}</text>
						</view>
					</view>
					<view class="right">
						<!-- <text v-if="item.state == 1" class="reds">未入账</text>
						<text v-else class="greens">已入账</text> -->
						<u-icon name="arrow-right" color="#6574bc" size="20"></u-icon>
					</view>
				</view>
			</view>
			<u-empty v-else mode="list" icon="/static/Empty/data_null.png">
			</u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: 1,
				date: '',
				lists: [],
			}
		},
		onLoad(e) {
			this.type = e.type
			this.date = e.date
			this.loadData()
		},
		methods: {
			// 加载数据
			async loadData() {
				uni.showLoading({
					title: '加载中'
				});
				const {
					data: res
				} = await this.$myHttp({
					url: 'v1/getUserBalanceTotalList',
					data: {
						type: this.type,
						date: this.date
					}
				});
				uni.hideLoading()
				if (res.code == 200) {
					this.lists = res.data
				}
			},
			// 详情
			dayClick(date) {
				uni.navigateTo({
					url: '/pages/hzy/cash/total/detail?type=' + this.type + '&date=' + date
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main {
		.list {
			background-color: #ffffff;
		
			.item {
				padding: 30rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				border-bottom: 1px solid #d1d5e3;
		
				.title {
					font-weight: bold;
				}
		
				.money {
					padding-top: 10rpx;
					font-size: 28rpx;
					color: #909399;
				}
		
				.right {
					display: flex;
		
					text {
						margin-right: 30rpx;
						padding: 10rpx 30rpx;
						color: #ffffff;
						border-radius: 20rpx;
						font-size: 24rpx;
					}
		
					.reds {
						background-color: #fa3534;
					}
		
					.greens {
						background-color: #19be6b;
					}
				}
			}
		}
	}
</style>